(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 10.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 6403, 204] NotebookOptionsPosition[ 5558, 173] NotebookOutlinePosition[ 6025, 191] CellTagsIndexPosition[ 5982, 188] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{ RowBox[{ "Quadratura", " ", "de", " ", "f", " ", "composta", " ", "de", " ", "ponto", " ", "medio"}], ",", RowBox[{ RowBox[{ "usando", " ", "particao", " ", "uniforme", " ", "em", " ", "n", " ", "subintervalos", " ", RowBox[{"de", " ", "[", RowBox[{"a", ",", "b"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"precisao", " ", "casas", " ", RowBox[{"decimais", ":", " ", "prec"}]}]}]}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"f", "[", "x_", "]"}], ":=", RowBox[{"Sin", "[", "x", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"a", "=", "0"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"b", "=", "Pi"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Nmax", "=", "10"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"prec", "=", "10"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Print", "[", "\"\\"", "]"}], ";"}], " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"n", "=", "1"}], ",", RowBox[{"n", "\[LessEqual]", "Nmax"}], ",", RowBox[{"n", "++"}], ",", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"n", ",", "\"\< \>\"", ",", "\[IndentingNewLine]", RowBox[{"N", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"b", "-", "a"}], ")"}], "/", "n"}], " ", RowBox[{"Sum", "[", RowBox[{ RowBox[{"f", "[", RowBox[{"a", "+", RowBox[{ RowBox[{"(", RowBox[{"i", "+", RowBox[{"1", "/", "2"}]}], ")"}], RowBox[{ RowBox[{"(", RowBox[{"b", "-", "a"}], ")"}], "/", "n"}]}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "0", ",", RowBox[{"n", "-", "1"}]}], "}"}]}], "]"}]}], ",", "prec"}], "]"}]}], "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "]"}], ";"}]}]}]], "Input"], Cell[CellGroupData[{ Cell[BoxData["\<\"n valor quadratura\"\>"], "Print"], Cell[BoxData[ InterpretationBox[ RowBox[{ "1", "\[InvisibleSpace]", "\<\" \"\>", "\[InvisibleSpace]", "3.1415926535897932385`10.000000000000004"}], SequenceForm[1, " ", 3.1415926535897932385`10.000000000000004], Editable->False]], "Print"], Cell[BoxData[ InterpretationBox[ RowBox[{ "2", "\[InvisibleSpace]", "\<\" \"\>", "\[InvisibleSpace]", "2.2214414690791832753614287635`10."}], SequenceForm[2, " ", 2.2214414690791832753614287635`10.], Editable->False]], "Print"], Cell[BoxData[ InterpretationBox[ RowBox[{ "3", "\[InvisibleSpace]", "\<\" \"\>", "\[InvisibleSpace]", "2.0943951023931954923084289224`9.999999999999998"}], SequenceForm[3, " ", 2.0943951023931954923084289224`9.999999999999998], Editable->False]], "Print"], Cell[BoxData[ InterpretationBox[ RowBox[{ "4", "\[InvisibleSpace]", "\<\" \"\>", "\[InvisibleSpace]", "2.0523443059540617777429355537`10.000000000000004"}], SequenceForm[4, " ", 2.0523443059540617777429355537`10.000000000000004], Editable->False]], "Print"], Cell[BoxData[ InterpretationBox[ RowBox[{ "5", "\[InvisibleSpace]", "\<\" \"\>", "\[InvisibleSpace]", "2.0332814769261039263238036053`9.999999999999998"}], SequenceForm[5, " ", 2.0332814769261039263238036053`9.999999999999998], Editable->False]], "Print"], Cell[BoxData[ InterpretationBox[ RowBox[{ "6", "\[InvisibleSpace]", "\<\" \"\>", "\[InvisibleSpace]", "2.0230303198549252243860021871`10."}], SequenceForm[6, " ", 2.0230303198549252243860021871`10.], Editable->False]], "Print"], Cell[BoxData[ InterpretationBox[ RowBox[{ "7", "\[InvisibleSpace]", "\<\" \"\>", "\[InvisibleSpace]", "2.0168841759442569668572128975`9.999999999999998"}], SequenceForm[7, " ", 2.0168841759442569668572128975`9.999999999999998], Editable->False]], "Print"], Cell[BoxData[ InterpretationBox[ RowBox[{ "8", "\[InvisibleSpace]", "\<\" \"\>", "\[InvisibleSpace]", "2.0129090855991278640723219168`10."}], SequenceForm[8, " ", 2.0129090855991278640723219168`10.], Editable->False]], "Print"], Cell[BoxData[ InterpretationBox[ RowBox[{ "9", "\[InvisibleSpace]", "\<\" \"\>", "\[InvisibleSpace]", "2.0101901159504203726575925944`9.999999999999998"}], SequenceForm[9, " ", 2.0101901159504203726575925944`9.999999999999998], Editable->False]], "Print"], Cell[BoxData[ InterpretationBox[ RowBox[{ "10", "\[InvisibleSpace]", "\<\" \"\>", "\[InvisibleSpace]", "2.0082484079079744045403681636`10."}], SequenceForm[10, " ", 2.0082484079079744045403681636`10.], Editable->False]], "Print"] }, Open ]] }, Open ]] }, WindowSize->{928, 921}, WindowMargins->{{138, Automatic}, {192, Automatic}}, PrivateNotebookOptions->{"VersionedStylesheet"->{"Default.nb"[8.] -> False}}, Magnification:>1.5 Inherited, FrontEndVersion->"10.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (December 4, \ 2014)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 2287, 63, 419, "Input"], Cell[CellGroupData[{ Cell[2892, 89, 52, 0, 30, "Print"], Cell[2947, 91, 252, 6, 30, "Print"], Cell[3202, 99, 240, 6, 30, "Print"], Cell[3445, 107, 268, 6, 30, "Print"], Cell[3716, 115, 270, 6, 30, "Print"], Cell[3989, 123, 268, 6, 30, "Print"], Cell[4260, 131, 240, 6, 30, "Print"], Cell[4503, 139, 268, 6, 30, "Print"], Cell[4774, 147, 240, 6, 30, "Print"], Cell[5017, 155, 268, 6, 30, "Print"], Cell[5288, 163, 242, 6, 30, "Print"] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)